#!/bin/bash -e

#---------------------------------------------------
# config default component
#---------------------------------------------------

# hardware video decoder
export CONFIG_ENABLE_VIDEO_DECODE=1
# hardware video encoder
export CONFIG_ENABLE_VIDEO_ENCODE=1
# audio decoder&encoder
export CONFIG_ENABLE_AUDIO_CODEC=1
# lindplayer, a media file player
export CONFIG_ENABLE_LINDPLAYER=1
# esplayer, for playing H264/H265 es
export CONFIG_ENABLE_ESPLAYER=1
# ffdemuxer, for media file paser or stream receiver
export CONFIG_ENABLE_FFSOURCE=1
# ffmuxer, for media file muxer or media streaming
export CONFIG_ENABLE_FFSINK=1
# live555, for rtsp media streaming
export CONFIG_ENABLE_LIVESINK=1
# rtp protocol, payload H264/H265
export CONFIG_ENABLE_LINDRTP=1
# lindtunnel, a protocol for device discovery and communication
export CONFIG_ENABLE_LINDTUNNEL=1
# lindcamera, a camera app support video preview, recorder and taking picture
export CONFIG_ENABLE_LINDCAMERA=1
# mmpublish host, a video-multicast sender
export CONFIG_ENABLE_MMPUBLISH_HOST=0
# mmpublish device, a video-multicast receiver
export CONFIG_ENABLE_MMPUBLISH_DEVICE=0
# lindipcam, a ip camera app
export CONFIG_ENABLE_LINDIPCAM=1
# wifi-ctrl, a wrapper of wifi-ops
export CONFIG_ENABLE_WIFI_CTRL=1
# huge-wifi, a wrapper of huge-wifi-ops
export CONFIG_ENABLE_HUGE_WIFI=1
# openCV, support motion detection
export CONFIG_ENABLE_OPENCV=1
# MIDI, convert midi to PCM
export CONFIG_ENABLE_MIDI=1
# ir light control
export CONFIG_ENABLE_IR_LIGHT=1
# motor
export CONFIG_ENABLE_MOTOR=1
# barcode
export CONFIG_ENABLE_BARCODE=1
# modbus
export CONFIG_ENABLE_MODBUS=1
# mbedtls & https
export CONFIG_ENABLE_HTTPS=1
# sqlite
export CONFIG_ENABLE_SQLITE=1
# dosfstools
export CONFIG_ENABLE_DOSFSTOOLS=1

# set video decoder memory-saving mode
export CONFIG_LOWRAM=0

# define a writable directory for APP save the user data
export USER_DATA_PATH=/tmp

# define a writable directory for APP save log
export LOG_FILE_NAME=$USER_DATA_PATH/log_file.log
export LOG_FILE_MAX_SIZE=64000
export LOG_FILE_MAX_ROTATE=8

#-------------------------------------------------------------------------------
# copy the binaries to linux sdk rootfs
#
# usage: make_release_rootfs [rootfs_path] <release_note>
#    rootfs_path: destination directory of the rootfs
#    release_note[optional]: release note
#-------------------------------------------------------------------------------
function make_release_rootfs()
{
	if [ x"$1" = x ]; then
		printf "\033[32m"
		echo "unknown rootfs path"
		echo "usage: make_release_rootfs [rootfs_path] <release_note>"
		printf "\033[0m"
		return
	fi

	mkdir -p $1/usr/lib
	mkdir -p $1/usr/bin
	mkdir -p $1/etc

	cp -d $OUT_DIR/lib/lib*.so*     $1/usr/lib/
	cp $OUT_DIR/bin/*               $1/usr/bin/
	cp $OUT_DIR/etc/*               $1/etc/

	$CROSS_COMPILE-strip $1/usr/lib/*
	$CROSS_COMPILE-strip $1/usr/bin/*
}
